package system

import (
	"context"
	"gf-assistant/internal/common/factory"
	"gf-assistant/internal/system/parameter"
)

// Menu 菜单控制器类
var Menu = MenuController{service: "system.MenuService"}

type MenuController struct{ service string }

func (c *MenuController) ListMenu(ctx context.Context, req *parameter.ListMenuReq) (res *parameter.ListMenuRes, err error) {
	return GetMenuService().ListMenu(ctx, req), nil
}
func (c *MenuController) CreateRootMenu(ctx context.Context, req *parameter.CreateRootMenuReq) (res *parameter.CreateRootMenuRes, err error) {
	return GetMenuService().CreateRootMenu(ctx, req), nil
}
func (c *MenuController) SaveMenu(ctx context.Context, req *parameter.SaveMenuReq) (res *parameter.SaveMenuRes, err error) {
	return GetMenuService().SaveMenu(ctx, req), nil
}
func (c *MenuController) DeleteMenu(ctx context.Context, req *parameter.DeleteMenuReq) (res *parameter.DeleteMenuRes, err error) {
	return GetMenuService().DeleteMenu(ctx, req), nil
}
func (c *MenuController) GetPermission(ctx context.Context, req *parameter.GetPermissionReq) (res *parameter.GetPermissionRes, err error) {
	return GetMenuService().GetPermission(ctx, req), nil
}
func GetMenuService() *MenuService {
	return factory.Get(Menu.service).(*MenuService)
}
